<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: OpenTok::Client
  
    &mdash; Documentation by YARD 0.8.7.3
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!" + escape(window.location.href);
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (C)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../OpenTok.html" title="OpenTok (module)">OpenTok</a></span></span>
     &raquo; 
    <span class="title">Client</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Class: OpenTok::Client
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">Object</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">OpenTok::Client</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
      <dt class="r2">Includes:</dt>
      <dd class="r2">HTTParty</dd>
      
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/opentok/client.rb</dd>
  
</dl>
<div class="clear"></div>








  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#create_session-instance_method" title="#create_session (instance method)">- (Object) <strong>create_session</strong>(opts) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#delete_archive-instance_method" title="#delete_archive (instance method)">- (Object) <strong>delete_archive</strong>(archive_id) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_archive-instance_method" title="#get_archive (instance method)">- (Object) <strong>get_archive</strong>(archive_id) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#initialize-instance_method" title="#initialize (instance method)">- (Client) <strong>initialize</strong>(api_key, api_secret, api_url) </a>
    

    
  </span>
  
  
    <span class="note title constructor">constructor</span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>TODO: expose a setting for http debugging for developers debug_output
$stdout.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#list_archives-instance_method" title="#list_archives (instance method)">- (Object) <strong>list_archives</strong>(offset, count) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#start_archive-instance_method" title="#start_archive (instance method)">- (Object) <strong>start_archive</strong>(session_id, opts) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#stop_archive-instance_method" title="#stop_archive (instance method)">- (Object) <strong>stop_archive</strong>(archive_id) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  <div id="constructor_details" class="method_details_list">
  <h2>Constructor Details</h2>
  
    <div class="method_details first">
  <h3 class="signature first" id="initialize-instance_method">
  
    - (<tt><span class='object_link'><a href="" title="OpenTok::Client (class)">Client</a></span></tt>) <strong>initialize</strong>(api_key, api_secret, api_url) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>TODO: expose a setting for http debugging for developers debug_output
$stdout</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


11
12
13
14
15
16
17
18</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/opentok/client.rb', line 11</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_api_key'>api_key</span><span class='comma'>,</span> <span class='id identifier rubyid_api_secret'>api_secret</span><span class='comma'>,</span> <span class='id identifier rubyid_api_url'>api_url</span><span class='rparen'>)</span>
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_base_uri'>base_uri</span> <span class='id identifier rubyid_api_url'>api_url</span>
  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lparen'>(</span><span class='lbrace'>{</span> 
    <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>X-TB-PARTNER-AUTH</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_api_key'>api_key</span><span class='rbrace'>}</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_api_secret'>api_secret</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
    <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>User-Agent</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>OpenTok-Ruby-SDK/</span><span class='embexpr_beg'>#{</span><span class='const'>VERSION</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='ivar'>@api_key</span> <span class='op'>=</span> <span class='id identifier rubyid_api_key'>api_key</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
  
</div>


  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="create_session-instance_method">
  
    - (<tt>Object</tt>) <strong>create_session</strong>(opts) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


20
21
22
23
24
25
26
27
28
29
30</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/opentok/client.rb', line 20</span>

<span class='kw'>def</span> <span class='id identifier rubyid_create_session'>create_session</span><span class='lparen'>(</span><span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/session/create</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:body</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
  <span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
  <span class='kw'>when</span> <span class='lparen'>(</span><span class='int'>200</span><span class='op'>..</span><span class='int'>300</span><span class='rparen'>)</span>
    <span class='id identifier rubyid_response'>response</span>
  <span class='kw'>when</span> <span class='int'>403</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokAuthenticationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Authentication failed while creating a session. API Key: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Failed to create session. Response code: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="delete_archive-instance_method">
  
    - (<tt>Object</tt>) <strong>delete_archive</strong>(archive_id) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


107
108
109
110
111
112
113
114
115
116
117
118
119
120
121</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/opentok/client.rb', line 107</span>

<span class='kw'>def</span> <span class='id identifier rubyid_delete_archive'>delete_archive</span><span class='lparen'>(</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/v2/partner/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_content'>/archive/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span>
    <span class='symbol'>:headers</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
  <span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
  <span class='kw'>when</span> <span class='int'>204</span>
    <span class='id identifier rubyid_response'>response</span>
  <span class='kw'>when</span> <span class='int'>403</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokAuthenticationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Authentication failed or an invalid Archive ID was given while deleting an archive. API Key: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_content'>, Archive ID: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>409</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be deleted. The status must be 'available', 'deleted', or 'uploaded'. Archive ID: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be deleted.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_archive-instance_method">
  
    - (<tt>Object</tt>) <strong>get_archive</strong>(archive_id) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


55
56
57
58
59
60
61
62
63
64
65
66
67</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/opentok/client.rb', line 55</span>

<span class='kw'>def</span> <span class='id identifier rubyid_get_archive'>get_archive</span><span class='lparen'>(</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/v2/partner/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_content'>/archive/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
  <span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
  <span class='kw'>when</span> <span class='int'>200</span>
    <span class='id identifier rubyid_response'>response</span>
  <span class='kw'>when</span> <span class='int'>400</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be retrieved. The Archive ID was invalid: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>403</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokAuthenticationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Authentication failed while retrieving an archive. API Key: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be retrieved.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="list_archives-instance_method">
  
    - (<tt>Object</tt>) <strong>list_archives</strong>(offset, count) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/opentok/client.rb', line 69</span>

<span class='kw'>def</span> <span class='id identifier rubyid_list_archives'>list_archives</span><span class='lparen'>(</span><span class='id identifier rubyid_offset'>offset</span><span class='comma'>,</span> <span class='id identifier rubyid_count'>count</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
  <span class='id identifier rubyid_query'>query</span><span class='lbracket'>[</span><span class='symbol'>:offset</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_offset'>offset</span> <span class='kw'>unless</span> <span class='id identifier rubyid_offset'>offset</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
  <span class='id identifier rubyid_query'>query</span><span class='lbracket'>[</span><span class='symbol'>:count</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_count'>count</span> <span class='kw'>unless</span> <span class='id identifier rubyid_count'>count</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/v2/partner/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_content'>/archive</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span>
    <span class='symbol'>:query</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_query'>query</span>
  <span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
  <span class='kw'>when</span> <span class='int'>200</span>
    <span class='id identifier rubyid_response'>response</span>
  <span class='kw'>when</span> <span class='int'>403</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokAuthenticationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Authentication failed while retrieving archives. API Key: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archives could not be retrieved.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="start_archive-instance_method">
  
    - (<tt>Object</tt>) <strong>start_archive</strong>(session_id, opts) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/opentok/client.rb', line 32</span>

<span class='kw'>def</span> <span class='id identifier rubyid_start_archive'>start_archive</span><span class='lparen'>(</span><span class='id identifier rubyid_session_id'>session_id</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>sessionId</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_session_id'>session_id</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>action</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>start</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
  <span class='id identifier rubyid_body'>body</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>name</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/v2/partner/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_content'>/archive</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span>
    <span class='symbol'>:body</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='comma'>,</span>
    <span class='symbol'>:headers</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
  <span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
  <span class='kw'>when</span> <span class='int'>200</span>
    <span class='id identifier rubyid_response'>response</span>
  <span class='kw'>when</span> <span class='int'>400</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be started. The request was invalid or the session has no connected clients.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>403</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokAuthenticationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Authentication failed while starting an archive. API Key: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>404</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be started. The Session ID does not exist: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_session_id'>session_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>409</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be started. The session could be peer-to-peer or the session is already being recorded.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be started</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="stop_archive-instance_method">
  
    - (<tt>Object</tt>) <strong>stop_archive</strong>(archive_id) 
  

  

  
</h3><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/opentok/client.rb', line 86</span>

<span class='kw'>def</span> <span class='id identifier rubyid_stop_archive'>stop_archive</span><span class='lparen'>(</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/v2/partner/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_content'>/archive/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lbrace'>{</span>
    <span class='symbol'>:body</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>action</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>stop</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='comma'>,</span>
    <span class='symbol'>:headers</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>application/json</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
  <span class='rbrace'>}</span><span class='rparen'>)</span>
  <span class='kw'>case</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_code'>code</span>
  <span class='kw'>when</span> <span class='int'>200</span>
    <span class='id identifier rubyid_response'>response</span>
  <span class='kw'>when</span> <span class='int'>400</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be stopped. The request was invalid.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>403</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokAuthenticationError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Authentication failed while stopping an archive. API Key: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@api_key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>404</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be stopped. The Archive ID does not exist: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_archive_id'>archive_id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>when</span> <span class='int'>409</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be stopped. The archive is not currently recording.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>else</span>
    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>OpenTokArchiveError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>The archive could not be started.</span><span class='tstring_end'>&quot;</span></span>
  <span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Wed May 14 18:26:56 2014 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.3 (ruby-1.9.3).
</div>

  </body>
</html>